﻿@using GSLMS.WebAPP
@model GSLMS.Entity.TB_LOAN_CONTRACTTMP
@{
  
}
   
  
<script type="text/javascript">
    /****************************************************
    *
    *		控件初始化WebOffice方法
    *
    ****************************************************/
    function WebOffice1_NotifyCtrlReady() {
        document.all.WebOffice1.OptionFlag |= 128;

        var webObj = document.getElementById("WebOffice1");
        webObj.ShowToolBar = false;


        var path = document.getElementById("SAVEURL").value;
        var documentType = "doc";

        if (path.endwith(".doc"))
            documentType = "doc";

        if (path.endwith(".xls"))
            documentType = "xls";

        document.all.WebOffice1.LoadOriginalFile(path, documentType);
        //document.all.WebOffice1.HideMenuItem("0x04");
        //setBookMarkValue();
    }

    /****************************************************
    *
    *		接收office事件处理方法
    *
    ****************************************************/
    var vNoCopy = 0;
    var vNoPrint = 0;
    var vNoSave = 0;
    var vClose = 0;
    function no_copy() {
        vNoCopy = 1;
    }
    function yes_copy() {
        vNoCopy = 0;
    }
    function no_print() {
        vNoPrint = 1;
    }
    function yes_print() {
        vNoPrint = 0;
    }
    function no_save() {
        vNoSave = 1;
    }
    function yes_save() {
        vNoSave = 0;
    }
    function EnableClose(flag) {
        vClose = flag;
    }
    function CloseWord() {

        document.all.WebOffice1.CloseDoc(0);
    }

    function TO_NotifyWordEvent(eventname) {
        //alert(eventname);
        //document.all.WebOffice1.lContinue = 1;

                if (eventname == "DocumentBeforeSave") {
                    if (vNoSave) {
                        document.all.WebOffice1.lContinue = 0;
                        alert("此文档已经禁止保存");
                    } else {
                        document.all.WebOffice1.lContinue = 1;
                    }
                } else if (eventname == "DocumentBeforePrint") {
                    if (vNoPrint) {
                        document.all.WebOffice1.lContinue = 0;
                        alert("此文档已经禁止打印");
                    } else {
                        document.all.WebOffice1.lContinue = 1;
                    }
                } else if (eventname == "WindowSelectionChange") {
                    if (vNoCopy) {
                        document.all.WebOffice1.lContinue = 0;
                        //alert("此文档已经禁止复制");
                    } else {
                        document.all.WebOffice1.lContinue = 1;
                    }
                } else if (eventname == "DocumentBeforeClose") {
                    if (vClose == 0) {
                        document.all.WebOffice1.lContinue = 0;
                    } else {
                        //alert("word");
                        document.all.WebOffice1.lContinue = 1;
                    }
                }
                var ajaxbg = $("#background,#progressBar");
                ajaxbg.hide();
        
    }
    function JustView() {
        vNoCopy = 1;
        vNoPrint = 1;
        vNoSave = 1;
    }

    function setBookMarkValue() {

        document.all.WebOffice1.ProtectDoc(1, 2, "321432");
    }

    function Save() {
        document.all.WebOffice1.HttpInit();
        var returnValue = document.all.WebOffice1.HttpPost("/Contract/ConTmp/EditConTmpFile");
        alert(returnValue);
    }
    function openParamDoc() {
        window.open("ParamList.htm", "param", "width=550; height=700,status=no,scrollbars=yes,resizable=yes");
    }
    function openParamDoc1() {
        window.open("ParamApplyList.htm", "param", "width=550; height=700,status=no,scrollbars=yes,resizable=yes");
    }
</script>
<div class="pageContent">
   <form method="post" action="Contract/ConTmp/EditConTmpFile?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
    onsubmit="return iframeCallback(this, dialogAjaxDone);">
    @Html.HiddenFor(model=>model.SAVEURL)
  <div class="pageFormContent" layouth="80">
  <p style="width:100%;">
  <span>
    <input type="button" value="保存模板" class="btn" onclick="Save();" />&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="Contract/ConTmp/ParamList/0" target="_blank" rel="paramlist">查看一般合同可用参数列表</a>
     @*<a href="javascript:openParamDoc1();">查看申请表参数列表</a>*@
  </span>
  <span>如果您不能正常查看模板，请 <a href="Scripts/WebOffice/WebOffice_Setup.rar"   target="_blank">点击下载控件</a> 并安装。（仅支持IE浏览器）</span>
  </p>
  <p style="width:97%; height:550px;">
   
    <OBJECT id="WebOffice1" height="520" width="100%" style="LEFT: 0px; TOP: 0px" 
classid="clsid:E77E049B-23FC-4DB8-B756-60529A35FAD5"  codebase="Scripts/WebOffice/weboffice_V6.0.4.4.cab#Version=6,0,4,4">
	<PARAM NAME="_Version" VALUE="65536">
	<PARAM NAME="_ExtentX" VALUE="2646">
	<PARAM NAME="_ExtentY" VALUE="1323">
	<PARAM NAME="_StockProps" VALUE="0"></OBJECT> 

    
  </p>


     </div>
   
    

    </form>

    
</div>
<script type="text/javascript"  language="javascript"  event="NotifyCtrlReady" for="WebOffice1">
    /****************************************************
    *
    *	在装载完Weboffice(执行<object>...</object>)
    *	控件后执行 "WebOffice1_NotifyCtrlReady"方法
    *
    ****************************************************/    	
	    WebOffice1_NotifyCtrlReady();
</script>
<script type="text/javascript" language="javascript" event="NotifyWordEvent(eventname)" for="WebOffice1">
   TO_NotifyWordEvent("WindowSelectionChange");
</script>
